
if (IsConfigurableAddOn("ChatEnhance") or IsConfigurableAddOn("BubbleChat")) then
	if (GetLocale() == "zhCN") then
		CHAT_ENHANCEMENT_TITLE = {"聊天增强", "liaotianzengqiang",2};
		BUBBLECHAT_ENABLE_TEXT= "开启泡泡聊天";
		SCROLL_CHATFRAME_TEXT = "允许使用鼠标滚轮滚动聊天窗口";
		BFC_ENABLE_TEXT = "开启大脚聊天增强"
		PLAYER_LINK_ENABLE_TEXT = "增强聊天窗口的玩家链接功能"; 
		BFC_CONFIG="聊天配置"
		BFC_DISABLE_DELAY_TEXT = "|cff00c0c0<大脚聊天>|r 你已经关闭大脚聊天(BigFootChat)模块，该设置将在下次插件载入时生效。";
	elseif (GetLocale() == "zhTW") then
		CHAT_ENHANCEMENT_TITLE = {"聊天增強", "liaotianzengqiang",2};
		BUBBLECHAT_ENABLE_TEXT= "開啟泡泡聊天";
		SCROLL_CHATFRAME_TEXT = "允許使用鼠標滾輪滾動聊天窗口";
		BFC_ENABLE_TEXT = "開啟大腳聊天增強"
		PLAYER_LINK_ENABLE_TEXT = "增強聊天視窗的玩家鏈結功能"; 	
		BFC_CONFIG="聊天配置"
		BFC_DISABLE_DELAY_TEXT = "|cff00c0c0<大腳聊天>|r 妳已經關閉大腳聊天(BigFootChat)模塊，該設置將在下次插件載入時生效。";
	else
		CHAT_ENHANCEMENT_TITLE = "Chat Enhancement";
		BUBBLECHAT_ENABLE_TEXT= "Enable BubbleChat";
		SCROLL_CHATFRAME_TEXT = "Allow using mouse wheel to scroll chat window";
		BFC_ENABLE_TEXT = "Enable BigFootChat"
		PLAYER_LINK_ENABLE_TEXT = "Enhance player linke in chat window";
		BFC_CONFIG="Config BFC"
	end

	ModManagement_RegisterMod(
		"ChatEnhancement",
		"Interface\\Icons\\Spell_Magic_PolymorphChicken",
		CHAT_ENHANCEMENT_TITLE,
		"",
		nil,
		nil,
		{[3]=true,[7]=true}
	);
end

if (IsConfigurableAddOn("BubbleChat")) then
	ModManagement_RegisterCheckBox(
		"ChatEnhancement",
		BUBBLECHAT_ENABLE_TEXT,
		nil,
		"EnableBubbleChat",
		1,
		function (arg)
			if (arg == 1) then
				if (not BigFoot_IsAddOnLoaded("BubbleChat")) then
					BigFoot_LoadAddOn("BubbleChat");
				end
				
				if (BigFoot_IsAddOnLoaded("BubbleChat")) then
					BubbleChat_Toggle(true);
				end
			else
				if (BigFoot_IsAddOnLoaded("BubbleChat")) then
					BubbleChat_Toggle(false);
				end
			end
		end
	);
end

if (IsConfigurableAddOn("ChatEnhance")) then
	ModManagement_RegisterCheckBox(
		"ChatEnhancement",
		SCROLL_CHATFRAME_TEXT,
		nil,
		"EnableScrollChatFrame",
		1,
		function (arg)
			if (arg == 1) then
				if (not BigFoot_IsAddOnLoaded("ChatEnhance")) then
					BigFoot_LoadAddOn("ChatEnhance");
				end
				
				if (BigFoot_IsAddOnLoaded("ChatEnhance")) then
					ChatEnahnce_Toggle(true);
				end
			else
				if (BigFoot_IsAddOnLoaded("ChatEnhance")) then
					ChatEnahnce_Toggle(false);
				end
			end
		end
	);
end

if (IsConfigurableAddOn("PlayerLink")) then
	ModManagement_RegisterCheckBox( 
		"ChatEnhancement", 
		PLAYER_LINK_ENABLE_TEXT, 
		nil, 
		"EnablePlayerLink",
		1, 
		function(arg1)
			if (arg1 == 1) then
				if (not BigFoot_IsAddOnLoaded("PlayerLink")) then
					BigFoot_LoadAddOn("PlayerLink");
				end

				if (BigFoot_IsAddOnLoaded("PlayerLink")) then
					PlayerLink_Toggle(true);
				end
			else
				if (BigFoot_IsAddOnLoaded("PlayerLink")) then
					PlayerLink_Toggle(false);
				end
			end
		end
	);
end

if (IsConfigurableAddOn("BigFootChat")) then
	ModManagement_RegisterCheckBox( 
		"ChatEnhancement", 
		BFC_ENABLE_TEXT, 
		nil, 
		"EnableBFC",
		1, 
		function(arg1)
			if (arg1 == 1) then
				if (not BigFoot_IsAddOnLoaded("BigFootChat")) then
					BigFoot_LoadAddOn("BigFootChat");
				end

				if (BigFoot_IsAddOnLoaded("BigFootChat")) then
					BigFootChat:Enable();
				end
			else
				if (BigFoot_IsAddOnLoadedFromBigFoot("BigFootChat")) then
					BigFootChat:Disable();
					BigFoot_RequestReloadUI(function() BigFoot_Print(BFC_DISABLE_DELAY_TEXT); end);
				end
			end
		end
	);
	ModManagement_RegisterButton(
		"ChatEnhancement",
		BFC_CONFIG,
		function()
			if BigFoot_IsAddOnLoaded("BigFootChat")  then
				BigFootChat:ShowOptions()
				PlaySound("igMainMenuOption");
				HideUIPanel(ModManagementFrame);
			end
		end,
		nil,
		1
	);
	
	
end